﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Owin.Hosting;

namespace ChanTai.WebApi
{
    /// <summary>
    /// 启动
    /// </summary>
    public static class StartTool
    {
        /// <summary>
        /// 启动
        /// </summary>
        /// <param name="sour"></param>
        public static IDisposable Start(this ServiceBase sour)
        {
            var edp = System.Configuration.ConfigurationManager.AppSettings.Get("ServiceHost");
            if (string.IsNullOrEmpty(edp)) edp = "http://localhost:9000/";
            return WebApp.Start<Startup>(edp);

        }

        /// <summary>
        /// 启动
        /// </summary>
        /// <returns></returns>
        public static IDisposable Start()
        {
            return Start(null);
        }
    }
}
